import request from '@/utils/request'

export function add(data) {
  return request({
    url: 'api/inventoryCheckOrder',
    method: 'post',
    data
  })
}

export function del(ids) {
  return request({
    url: 'api/inventoryCheckOrder/',
    method: 'delete',
    data: ids
  })
}

export function edit(data) {
  return request({
    url: 'api/inventoryCheckOrder',
    method: 'put',
    data
  })
}

// 查询在库库存(展示物料种类)
export function getProductListAPI(data) {
  return request({
    url: 'api/inventory/queryProductNoList',
    method: 'get',
    data
  })
}

// 取消盘点单
export function cancelOrderAPI(data) {
  return request({
    url: `api/inventoryCheckOrder/cancelInventoryCheckOrder/${data}`,
    method: 'get',
    data
  })
}

// 执行盘点单
export function excuteOrderAPI(data) {
  return request({
    url: `api/inventoryCheckOrder/startInventoryCheckOrder/${data}`,
    method: 'get',
    data
  })
}

// 创建盘点单
export function createOrderAPI(data) {
  return request({
    url: 'api/inventoryCheckOrder/addInventoryCheckOrder',
    method: 'post',
    data
  })
}

// 根据port口获取模式
export function getPortListAPI(data) {
  return request({
    url: `api/configurations/getPortList/${data}`,
    method: 'post',
    data
  })
}

export default { add, edit, del }
